package com.dao.impl;

import java.util.List;
import java.util.Map;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import com.dao.IRoleDao;
import com.po.Menu;
import com.po.Role;
import com.po.RoleMenu;
import com.po.UserSys;

public class RoleDao extends SqlMapClientDaoSupport implements IRoleDao {

	public Integer deleteObejct(Role role) {
		return (Integer) getSqlMapClientTemplate().delete("Role.deleteById",role);
	}

	public Integer findByCount(Role role) {
		return (Integer) getSqlMapClientTemplate().queryForObject("Role.findByCount",role);
	}

	public List<Role> findByExist(Role role) {
		return (List<Role>)getSqlMapClientTemplate().queryForList("Role.findByExist",role);
	}

	public List<Role> findById(Role role) {
		return (List<Role>)getSqlMapClientTemplate().queryForList("Role.findById",role);
	}

	public List<Role> findByList(Role role) {
		return (List<Role>)getSqlMapClientTemplate().queryForList("Role.findByList",role);
	}

	public Integer saveObject(Role role) {
		return (Integer) getSqlMapClientTemplate().insert("Role.save",role);
	}

	public Integer updateObject(Role role) {
		return (Integer) getSqlMapClientTemplate().update("Role.updateById",role);
	}

	public Integer deleteByIdRoleMenu(Role role) {
		return (Integer) getSqlMapClientTemplate().delete("Role.deleteByIdRoleMenu",role);
	}

	public Integer deleteByIdUserRole(Role role) {
		return (Integer) getSqlMapClientTemplate().delete("Role.deleteByIdUserRole",role);
	}

	public Integer deleteByIdRoleUserOne(Map map) {
		return (Integer) getSqlMapClientTemplate().delete("Role.deleteByIdRoleUserOne",map);
	}

	public List<UserSys> findByRoleUser(Integer roleid) {
		return (List<UserSys>)getSqlMapClientTemplate().queryForList("Role.findByRoleUser",roleid);
	}

	public List<UserSys> findByRoleUserNot(Integer roleid) {
		return (List<UserSys>)getSqlMapClientTemplate().queryForList("Role.findByRoleUserNot",roleid);
	}

	public Integer saveByIdRoleUserOne(Map map) {
		return (Integer) getSqlMapClientTemplate().insert("Role.saveByIdRoleUserOne",map);
	}

	public List<RoleMenu> findByRoleMenu(Integer roleid) {
		return (List<RoleMenu>)getSqlMapClientTemplate().queryForList("Role.findByRoleMenu",roleid);
	}

	public List<Menu> findByRoleMenuAll() {
		return (List<Menu>)getSqlMapClientTemplate().queryForList("Role.findByRoleMenuAll");
	}

	public Integer saveByIdRoleMenuOne(Map map) {
		return (Integer) getSqlMapClientTemplate().insert("Role.saveByIdRoleMenuOne",map);
	}

	public Integer deleteByIdRoleUserId(Map map) {
		return (Integer) getSqlMapClientTemplate().delete("Role.deleteByIdRoleUserId",map);
	}

}
